/****************************************************************
 * cmps10.c														*
 * Hardware: CMPS10												*
 * Created: 30.12.2013 08:53:11									*
 * Author: Simon Feuerstein, Peter Gantner						*
 ***************************************************************/ 

#include "cmps10.h"

unsigned char cmps10_read_bearing_byte(void)
{
	unsigned char cmps10_bearing_byte;
	
	i2c_start(CMPS10Write);					//start Bit
	i2c_write(1);							//auszulesendes Register
	i2c_start(CMPS10Read);					//repeated start mit Read/Write-Bit high
	cmps10_bearing_byte = i2c_readNak;		//auslesen des Registers
	i2c_stop();
	
	return cmps10_bearing_byte;
}

double cmps10_read_bearing_double(void)
{
	double cmps10_bearing_double= cmps10_read_bearing_byte()*1.4117647058823529;
	return cmps10_bearing_double;
}